/**
 * 动态加载JS
 * @param {string} url 脚本地址
 * @param {function} callback  回调函数
 */
function dynamicLoadJs(url, callback) {
    var head = document.getElementsByTagName("head")[0];
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.src = url;
    if (typeof callback == "function") {
        script.onload = script.onreadystatechange = function () {
            if (
                !this.readyState ||
                this.readyState === "loaded" ||
                this.readyState === "complete"
            ) {
                callback();
                script.onload = script.onreadystatechange = null;
            }
        };
    }
    head.appendChild(script);
}

/**
 * 动态加载CSS
 * @param {string} url 样式地址
 */
function dynamicLoadCss(url) {
    var head = document.getElementsByTagName("head")[0];
    var link = document.createElement("link");
    link.type = "text/css";
    link.rel = "stylesheet";
    link.href = url;
    head.appendChild(link);
}



$(function () {
    $("#one").click(function () {


        var name = 1;
        var b = a + Name;
        var c = 1;


    });

    $("#two").click(function () {

        dynamicLoadJs('./111.css');


    });

    $("#three").click(function () {
        dynamicLoadCss('./222.js');
    });




    $("#four").click(function () {
        $.get("../a1/clear")
    });

    $("#five").click(function () {
        $.get("../a1/")
    });




    $("#clear").click(function () {
        $.get("../log/clear")
    });

});

